// app.js
App({
  onLaunch: function () {
    // 展示本地存储能力
    const logs = wx.getStorageSync('logs') || []
    logs.unshift(Date.now())
    wx.setStorageSync('logs', logs)

    // 登录
    wx.login({
      success: res => {
        // 发送 res.code 到后台换取 openId, sessionKey, unionId
        console.log('登录成功', res)
      }
    })
  },
  globalData: {
    userInfo: null,
    categories: [
      { id: 1, name: '餐饮', type: 'expense' },
      { id: 2, name: '交通', type: 'expense' },
      { id: 3, name: '购物', type: 'expense' },
      { id: 4, name: '娱乐', type: 'expense' },
      { id: 5, name: '医疗', type: 'expense' },
      { id: 6, name: '住房', type: 'expense' },
      { id: 7, name: '工资', type: 'income' },
      { id: 8, name: '奖金', type: 'income' },
      { id: 9, name: '理财', type: 'income' },
      { id: 10, name: '其他', type: 'income' }
    ]
  }
})
